/**
 * 跳转路由
 */
export const navigateTo = (url, params = {}) => {
  let str = "";
  for (let key in params) {
    str += `&${key}=${params[key]}`;
  }
  if (str === "") {
    str = "?" + str.substr(1);
  }
  wx.navigateTo({ url: url + str });
};
/**
 * 跳转路由
 */
export const redirectTo = (url, params = {}) => {
  let str = "";
  for (let key in params) {
    str += `&${key}=${params[key]}`;
  }
  if (str === "") {
    str = "?" + str.substr(1);
  }
  wx.redirectTo({ url: url + str });
};
/**
 * 提示信息
 * @param title {string} 提示文本信息
 * @param icon {string} 图标。可选值：success,error,loading,none
 */
export const showToast = (title = "", icon = "none") => {
  wx.showToast({
    title,
    icon,
  });
};
